package zb.stream;

import java.util.stream.Stream;

/**
 * @author wzby
 * @Date: 2022/8/5 14:06
 */
public class Stream4 {
    public static void main(String[] args) {
        Stream<Integer> is = Stream.of(1, 2, 3, 56, 24, 65, 13,90,10,1);
        //is.distinct().forEach(System.out::println);
        //遍历输出

        //System.out.println(is.max((a,b)->b-a).get());
        //System.out.println(is.max((a,b)->a-b).get());
        //min获得数组里的最小值，max获得数组里的最大值 a-b正序，b-a倒序

        //System.out.println(is.count());
        //.count（）元素数量之和

        //is.map(e->e+2).filter(e->e>10).forEach(System.out::println);

        System.out.println(is.filter(e->e%2 == 0).reduce((a,b)->a+b).get());
        Stream<User> us = Stream.of(new User("a",10,21),new User("a",10,21),new User("b",11,22));
        System.out.println(us.distinct().count());
    }
}
